/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJDialog.java
 *
 * Created on Oct 31, 2011, 6:22:09 PM
 */

package report;

import java.beans.PropertyVetoException;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Bich Tran Van
 */
public class DialogReport extends javax.swing.JDialog {

    private  String url = null;
    /** Creates new form NewJDialog */
    public DialogReport(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    public DialogReport(java.awt.Frame parent, boolean modal,String url, int id) {
        super(parent, modal);
        initComponents();
        this.url = url;
        try {
        HashMap map = new HashMap();
            map.put("b",id);
            Report re = new Report(url, map);
            re.setBounds(0, 0, desktopPane.getWidth(), desktopPane.getHeight());
            re.setVisible(true);
            desktopPane.add(re);
        
            re.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(DialogReport.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public DialogReport(java.awt.Frame parent, boolean modal,String url) {
        super(parent, modal);
        initComponents();
        this.url = url;
        try {
        HashMap map = new HashMap();
            Report re = new Report(url, map);
            re.setBounds(0, 0, desktopPane.getWidth(), desktopPane.getHeight());
            re.setVisible(true);
            desktopPane.add(re);

            re.setSelected(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(DialogReport.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktopPane = new javax.swing.JDesktopPane();
        btnOK = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Report");

        btnOK.setText("OK");
        btnOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOKActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 860, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(803, Short.MAX_VALUE)
                .addComponent(btnOK)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(desktopPane, javax.swing.GroupLayout.PREFERRED_SIZE, 480, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btnOK)
                .addContainerGap(13, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_btnOKActionPerformed
    
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                DialogReport dialog = new DialogReport(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnOK;
    private javax.swing.JDesktopPane desktopPane;
    // End of variables declaration//GEN-END:variables

}
